<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<?php
	$d1 = "";
	$d2 = "";
	$jieguo = 0;
	$yunsuanfu = "";
	if( !empty($_POST)){
		$d1 = $_POST['data1'];
		$d2 = $_POST["data2"];
		$yunsuanfu = $_POST["yunsuanfu"];
		switch ($yunsuanfu){
			case "+":
				$jieguo = $d1 + $d2;
				break;
			case "-":
				$jieguo = $d1 - $d2;
				break;
			case "*":
				$jieguo = $d1 * $d2;
				break;
			case "/":
				$jieguo = $d1 / $d2;
				break;
		}
		
	}
	
?>
<form action="" method="post">
		<input type="text" name="data1" value="<?php echo $d1; ?>"/>
		<select name="yunsuanfu">
			<option value="+" <?php if($yunsuanfu=="+"){ echo 'selected="selected"';} ?>>+</option>
			<option value="-" <?php if($yunsuanfu=="-"){ echo 'selected="selected"';} ?>>-</option>
			<option value="*" <?php if($yunsuanfu=="*"){ echo 'selected="selected"';} ?>>*</option>
			<option value="/" <?php if($yunsuanfu=="/"){ echo 'selected="selected"';} ?>>/</option>		
		</select>
		<input type="text" name="data2" value="<?php echo $d2; ?>"/>
		<input type="submit" name="="/>
		<input type="text" name="result" value="<?php echo $jieguo; ?>" />
	</form>
</body>
</html>